

$(document).ready(function (){
    queryProvince();
});

/**
 * 查询单个数据通过多个条件模糊查询
 */
function queryProvince(){

    $.ajax({
        url:"/manufacturer/queryProvince",
        type:"post",
        data:{},
        dataType:"json",
        success:function (result){
                var str = "<option selected='selected' value='0'>请选择</option>";
                for (var i = 0; i < result.length; i++) {
                    str += "<option value='" + result[i].id + "'>"+result[i].pName+"</option>";
                }
                $("#prov").html(str);
        }
    })
}

function queryCity(){

    var id = $("#prov option:selected").val();
    $.ajax({
        url:"/manufacturer/queryCity",
        type:"post",
        data:{id:id},
        dataType:"json",
        success:function (result){
            var str = "<option selected='selected' value='0'>请选择</option>";
            for (var i = 0; i < result.length; i++) {
                str += "<option>"+result[i].c_Name+"</option>";
            }
            $("#cty").html(str);
        }
    })
}

function addFirm(){

    var Fname = $("#firmName").val();
    var founder = $("#founder").val();
    var tel = $("#tel").val();
    var address = $("#address").val();
    var city = $("#cty option:selected").text();
    var content = $("#wenben").val();
    var status = $("#status option:selected").val();
    var creatName = $("#creatName").val();
    $.ajax({
        url:"/manufacturer/addFirm",
        type:"post",
        data:{Fname:Fname,founder:founder,tel:tel,address:address,city:city,content:content,status:status,creatName:creatName},
        dataType:"json",
        success:function (result){
            if (result=="true"){
                alert("添加成功");
            }else {
                alert("添加失败");
            }
        }
    })
}